using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sandia.MVCFramework.Test
{    
    /// <summary>
    /// Generic test fixture that fails if an errors were logged during test run
    /// </summary>
    public class FailOnErrorLoggingTestFixture
    {
        /// <summary>
        /// Reset error logging flag before running test
        /// </summary>
        [SetUp]
        public void SetupTestFixture()
        {
            // Reset error flag
            NUnitTraceListener.Called = false;
        }

        /// <summary>
        /// Fail if any errors were logged during the test
        /// </summary>
        [TearDown]
        public void TeardownTestFixture()
        {
            // Make sure no errors were logged
            Assert.IsFalse(NUnitTraceListener.Called, "Error was caught during test - check Console.Error output for details");
        }
    }    
}
